# coding=utf-8
import requests
import re
from plus.cms import CmsSb
class Cms(object):
	header={'User-Agent':'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36'}
	def __init__(self):
		self.__cms = CmsSb()
	def cms_sbip(self,domeurl):#ip or dome
		'''
		:param domeurl: 列表1
		:return:
		'''
		with open(domeurl,'r') as fo:
			for li in fo.readlines():
				ur = li.strip('\n')
				ur1 = re.search(r"(http)",ur,re.I)#匹配网站是否有http，没有则添加头
				if ur1 == None:
					ur2 = 'http://'+ur
				else:
					ur2 = ur
				try:
					zt = requests.head(url=ur2,allow_redirects=False,verify=False,headers=self.header,timeout=10)#网站返回状态
					de = zt.status_code
				except Exception,e:
					continue
				print ur2+" "+str(de)
				if de == 401:
					continue
				if de == 200:
					self.__cms.Cx(line=ur2,zt=zt)#调用开发语言识别模块
if __name__ == '__main__':
	cms = Cms()
	line = 'url.txt'
	cms.cms_sbip(line)